# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=hy
pkgver=0.24.0
pkgrel=0
pkgdesc="Dialect of Lisp that's embedded in Python"
url="http://hylang.org/"
arch="noarch"
license="MIT"
# XXX: py3-astor can be removed with python3 >= 3.10
depends="python3 py3-funcparserlib py3-astor py3-rply py3-colorama"
makedepends="py3-setuptools py3-sphinx py3-sphinxcontrib-hydomain py3-sphinx_rtd_theme py3-wheel"
checkdepends="python3-tests py3-pytest py3-pytest-runner py3-tox"
subpackages="$pkgname-doc"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/hylang/hy/archive/$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

# By default setup.py tries to determine the hy version using
# git-describe(1). Unfourtunatly, this will return the version
# of the aports repository on Alpine.
export HY_VERSION="$pkgver"

build() {
	python3 setup.py build
	
	cd docs
	sphinx-build . _build -b man
}

check() {
	# Ignore tests requiring binaries to be installed
	py.test-3 --ignore tests/test_bin.py \
		--ignore tests/test_hy2py.py
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"

	local man
	for man in docs/_build/*.?; do
		install -Dm644 "$man" \
			"$pkgdir"/usr/share/man/man${man##*.}/${man##*/}
	done

	# This file is only needed for setuptools-produced source
	# distributions <https://github.com/hylang/hy/commit/bd7b8bf5e19e>.
	rm -rf "$pkgdir"/usr/get_version
}

sha512sums="
34be60a35683464e670560b83613da2fae34635f615c5d94412cb0a5b7615203a58f418862fe1192ac65620d68ee1ffba24a2f292bb4f862c923ca129fefacfa  hy-0.24.0.tar.gz
"
